#ifndef STORAGE_BLOB_PAGE_BLOB_H
#define STORAGE_BLOB_PAGE_BLOB_H 1

#include <common/macro/build.h>
#include <transaction/types.h>
#include <storage/itempointer.h>
#include <storage/page.h>

typedef enum page_blob_type_e {
	BLOB_SINGLE,
	BLOB_HEAD,
	BLOB_DATA,
	BLOB_TAIL,
} page_blob_type_e;

struct page_blob_t {
	transaction_id_t id_insert, id_delete;
	int deleted;

	page_blob_type_e type;
	page_number_t next;

	char *data;
	page_size_t size;

	page_t *common;
};

API_LIBLOCAL page_blob_t *page_blob_new(page_t *);
API_LIBLOCAL char page_blob_type_to_char(const page_blob_type_e );
API_LIBLOCAL page_blob_type_e page_blob_char_to_type(const char);
API_LIBLOCAL int page_blob_serialize(page_blob_t *, char *, ssize_t);
API_LIBLOCAL int page_blob_deserialize(page_blob_t **, char *, ssize_t, page_t *);
API_LIBLOCAL void page_blob_destroy(page_blob_t *);

#endif
